/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLongestSubstring = function (s) {
    let start = 0
    let end = 0
    let sArr = s.split('')
    let res = 0
    while (end !== sArr.length) {
        let currArr = sArr.slice(start, end)
        let index = currArr.findIndex(item => item === sArr[end])
        start = start + index + 1
        end++
        res = res > end - start  ? res : end - start 
    }
    return res
};